import { AbstractPlatform } from './AbstractPlatform';

export class PlatformFactory {
  private static platforms: Map<string, new () => AbstractPlatform> = new Map();

  static registerPlatform(name: string, platformClass: new () => AbstractPlatform): void {
    this.platforms.set(name, platformClass);
  }

  static createPlatform(name: string): AbstractPlatform {
    const PlatformClass = this.platforms.get(name);
    if (!PlatformClass) {
      throw new Error(`Platform ${name} is not registered`);
    }
    return new PlatformClass();
  }

  static getAvailablePlatforms(): string[] {
    return Array.from(this.platforms.keys());
  }
}